import { ApiProperty } from '@nestjs/swagger';
import { IsDateString, IsNotEmpty } from 'class-validator';

export class CreateUserDto {
  @ApiProperty({
    description: '公司名称',
  })
  @IsNotEmpty({ message: '公司名称不能为空' })
  name: string;

  @ApiProperty({
    description: '有效期',
  })
  @IsNotEmpty({ message: '有效期不能为空' })
  expirationAt: Date;

  @ApiProperty({
    description: '公司介绍',
  })
  @IsNotEmpty({ message: '公司介绍不能为空' })
  introduction: string;

  @ApiProperty({
    description: '公司地址',
  })
  @IsNotEmpty({ message: '公司地址不能为空' })
  address: string;

  @ApiProperty({
    description: '员工账号数量',
  })
  @IsNotEmpty({ message: '员工账号数量不能为空' })
  employeeNum: number;

  @ApiProperty({
    description: '公司图标',
  })
  CompanyIcon: string;
}

export class CompareDateDto {
  @ApiProperty({
    description: '公司id',
  })
  @IsNotEmpty({ message: '公司id不能为空' })
  companyId: string;
}

export class QueryInfo {
  @ApiProperty({
    description: '关键词',
    required: false,
  })
  name: string;
  @ApiProperty({
    description: '是否有效期内',
    required: false,
    default: 1,
  })
  isValid: boolean;
  @ApiProperty({
    description: '每页显示的数量',
    required: false,
    default: 10,
  })
  per: number;
  @ApiProperty({
    description: '页码',
    required: false,
    default: 1,
  })
  page: number;
}

export class RenewCompany {
  @ApiProperty({
    description: '公司id',
  })
  @IsNotEmpty({ message: '公司id不能为空' })
  companyId: string;

  @ApiProperty({
    description: '续费时间',
  })
  @IsDateString({}, { message: '续费时间格式不正确' })
  time: Date;
}

export class QueryInfoCompanyUser {
  @ApiProperty({
    description: '公司id',
  })
  @IsNotEmpty({ message: '公司id不能为空' })
  companyId: string;
  @ApiProperty({
    description: '关键词',
    required: false,
  })
  name: string;
  @ApiProperty({
    description: '是否离职',
    required: false,
  })
  isLeave: boolean;
  @ApiProperty({
    description: '每页显示的数量',
    required: false,
    default: 10,
  })
  per: number;
  @ApiProperty({
    description: '页码',
    required: false,
    default: 1,
  })
  page: number;
}

export class CreateComponyUserDto {
  @ApiProperty({
    description: '公司id',
    required: true,
  })
  @IsNotEmpty({ message: '公司id不能为空' })
  companyId: string;

  @ApiProperty({
    description: '员工名字',
    required: true,
  })
  @IsNotEmpty({ message: '员工名字不能为空' })
  name: string;

  @ApiProperty({
    description: '是否投保',
    required: true,
  })
  @IsNotEmpty({ message: '是否投保不能为空' })
  isInsured: boolean;

  @ApiProperty({
    description: '工资',
    required: true,
  })
  @IsNotEmpty({ message: '工资不能为空' })
  salary: number;

  @ApiProperty({
    description: '性别 true: 男 false: 女',
    required: true,
  })
  @IsNotEmpty({ message: '性别不能为空' })
  sex: boolean;

  @ApiProperty({
    description: '出生日期',
    required: true,
  })
  @IsNotEmpty({ message: '出生日期不能为空' })
  birthday: Date;

  @ApiProperty({
    description: '民族',
    required: true,
  })
  @IsNotEmpty({ message: '民族不能为空' })
  nation: string;

  @ApiProperty({
    description: '身份证号',
    required: true,
  })
  @IsNotEmpty({ message: '身份证号不能为空' })
  idCard: string;

  @ApiProperty({
    description: '学历',
    required: true,
  })
  @IsNotEmpty({ message: '学历不能为空' })
  education: string;

  @ApiProperty({
    description: '手机号',
    required: true,
  })
  @IsNotEmpty({ message: '手机号不能为空' })
  phone: string;

  @ApiProperty({
    description: '住址',
    required: true,
  })
  @IsNotEmpty({ message: '住址不能为空' })
  address: string;

  @ApiProperty({
    description: '年龄',
    required: true,
  })
  @IsNotEmpty({ message: '年龄不能为空' })
  age: number;

  @ApiProperty({
    description: '曾经待过的公司',
    required: true,
  })
  oldCompany?: string;
  @ApiProperty({
    description: '职位',
    required: true,
  })
  @IsNotEmpty({ message: '职位不能为空' })
  job: string;

  @ApiProperty({
    description: '入职时间',
    required: true,
  })
  @IsNotEmpty({ message: '入职时间不能为空' })
  entryTime: Date;

  @ApiProperty({
    description: '是否离职',
    required: true,
  })
  @IsNotEmpty({ message: '入职时间不能为空' })
  isLeave: boolean;

  @ApiProperty({
    description: '离职时间',
    required: true,
  })
  leaveTime: Date;
}

export class UpdateCompanyDto {
  @ApiProperty({
    description: '登录密码',
    required: true,
  })
  @IsNotEmpty({ message: '登录密码不能为空' })
  password: string;

  @ApiProperty({
    description: '公司图标',
    required: true,
  })
  CompanyIcon?: string;
}

export class LeaveCompanyUser {
  @ApiProperty({
    description: '员工id',
    required: true,
  })
  @IsNotEmpty({ message: '员工id不能为空' })
  id: string;

  @ApiProperty({
    description: '离职时间',
    required: true,
  })
  @IsNotEmpty({ message: '离职时间不能为空' })
  leaveTime: Date;
}
